/*
 * @Author: liyongxuan
 * @Date: 2018-1-10 10:37:42
 * @Last Modified by: liyongxuan
 * @Last Modified time: 2018-1-10 10:37:42
 * @description：项目管理-拟投资-项目详情
 */
<template>
  <div class="ca-box-border-top-none ca-p-20">
    <div v-if="indexOrEdit">
        <div class="ca-title">
            <el-button type="text" class="ca-edit-btn el-icon-edit ca-m-r-10 right-fs-30" v-if="isNoAuth('拟投资项目-项目详情-编辑')" @click="goEdit">编辑</el-button>
            <h3>项目详情</h3>
        </div>
      <el-form :model="resultData" label-width="160px">
        <el-row>
            <el-col :span="8">
                <el-form-item class="el-break" label="项目来源：">{{resultData.itemSource}}</el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item class="el-break" label="初步接触时间：">{{resultData.firstContact}}</el-form-item>                
            </el-col>
            <el-col :span="8">
                <el-form-item class="el-break" label="最近接触时间：">{{resultData.lastUpdate}}</el-form-item>                                 
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="8">
                <el-form-item class="el-break" label="创始人：">{{resultData.founder}}</el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item class="el-break" label="公司成立时间：">{{resultData.registrationTime}}</el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item class="el-break" label="企业性质：">{{resultData.companyNature|getNameById('nature')}}</el-form-item>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="8">
                <el-form-item label="注册资本（万元）：" class="el-break"><span class="color-money">{{resultData.registeredCapital|format1}}</span></el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="实收资本（万元）：" class="el-break"><span class="color-money">{{resultData.paidInCapital|format1}}</span></el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="股东人数：" class="el-break">{{resultData.shareholderNum}}</el-form-item>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="8">
                <el-form-item class="el-break" label="公司注册地址：">{{registeredAddress.registrationDetailed}}</el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item class="el-break" label="公司电话：">{{resultData.companyTel}}</el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item class="el-break" label="投资角色：">{{resultData.investRole|getNameById('investRole')}}</el-form-item>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="8">
                <el-form-item class="el-break" label="投前估值（万元）：">{{resultData.preValuation}}</el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item class="el-break" label="投后估值（万元）：">{{resultData.postValuation}}</el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item class="el-break" label="子基金项目管理人员：">{{resultData.subFundManager}}</el-form-item>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="8">
                <el-form-item class="el-break" label="基金外派董事：">{{resultData.fundAssigningDirectors}}</el-form-item> 
            </el-col>
            <el-col :span="8">
                <el-form-item class="el-break" label="基金外派监事：">{{resultData.fundExternalSupervisor}}</el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item class="el-break" label="项目轮次：">{{resultData.prostatus|getNameById('prostatus')}}</el-form-item>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="24">
                <el-form-item class="el-break" label="投资方式：">{{resultData.investmentWay}}</el-form-item>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="24">
                <el-form-item class="el-break" label="估值方式：">{{resultData.valuationMethod}}</el-form-item>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="24">
                <el-form-item class="el-break" label="连合投资：">{{resultData.jointInvestment}}</el-form-item>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="24">
                <el-form-item class="el-break" label="备注：">{{resultData.remark}}</el-form-item>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="24">
                <el-form-item class="el-break" label="其他：">{{resultData.other}}</el-form-item>
            </el-col>
        </el-row>
      </el-form>
    </div>
    <csProDetailEdit v-else :itemId="itemId" :proDetailEdit="resultData" @close="closeEdit" :officeAddress="officeAddress" :registeredAddress="registeredAddress"></csProDetailEdit>
  </div>
</template>

<script type="text/ecmascript-6">
    import {api} from '../api';
    import {STATUS_HTTP_SUCCESS, apiHttp} from '__service/csHttp';
    export default {
        data() {
            return {
                indexOrEdit: true,
                registeredAddress: {
                    id: '',
                    businessId: this.itemId,
                    province: '',
                    city: '',
                    district: '',
                    businessType: 1,
                    registrationDetailed: ''
                },
                officeAddress: {
                    id: '',
                    businessId: this.itemId,
                    province: '',
                    city: '',
                    district: '',
                    businessType: 2,
                    registrationDetailed: ''
                },
                resultData: {
                    'id': '',
                    'itemId': '',
                    'companyNature': null,
                    'prostatus': '',
                    'additional': null,
                    'startDate': null,
                    'investAmount': '',
                    'itemSource': '',
                    'founder': '',
                    'firstContact': null,
                    'lastUpdate': null,
                    'registrationTime': null,
                    'remark': '',
                    // 'registeredAddress': '',
                    'registeredCapital': null,
                    'shareholderNum': null,
                    'paidInCapital': null,
                    // 'officeAddress': '',
                    'securityCode': null,
                    'companyTel': null
                }
            }
        },
        watch: {
        },
        props: {
          itemId: {
            type: String,
            default: ''
          }
        },
        created() {
          },
        mounted() {
            this.getItemQuasiEntityDetails();
        },
        methods: {
            // 获取项目详情
            async getItemQuasiEntityDetails() {
                const {resCode,data} = await apiHttp(api.GET_ITEM_QUASI_ENTITY_DETAILS, {itemId: this.itemId})
                if (resCode === STATUS_HTTP_SUCCESS) {
                    this.resultData = data
                    let region = data.region
                    if (this.resultData.registrationTime !== '' && this.resultData.registrationTime !== null) {
                        this.resultData.registrationTime = this.$moment(this.resultData.registrationTime).format('YYYY-MM-DD')
                    }
                    if (this.resultData.firstContact !== '' && this.resultData.firstContact !== null) {
                        this.resultData.firstContact = this.$moment(this.resultData.firstContact).format('YYYY-MM-DD')
                    }
                    if (this.resultData.lastUpdate !== '' && this.resultData.lastUpdate !== null) {
                        this.resultData.lastUpdate = this.$moment(this.resultData.lastUpdate).format('YYYY-MM-DD')
                    }
                    // 处理地区
                    this.registeredAddress = {}
                    this.officeAddress = {}
                    if (region && region.length !== 0) {
                        region.map(item => {
                            if (item.businessType === 1) {
                                this.registeredAddress = item
                            } else if (item.businessType === 2) {
                                this.officeAddress = item
                            }
                        })
                    }
                }
            },
            // 关闭编辑页
            closeEdit() {
                this.indexOrEdit = true
                this.getItemQuasiEntityDetails()
            },
            // 编辑按钮
            goEdit() {
                this.indexOrEdit = false;
            }
        },
        components: {
          csProDetailEdit: require('./edit') //项目详情 编辑
        },
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.right-fs-30{
   float:right;
}
.color-money{
    color: #1386E2
}
.el-break {
    word-wrap:break-word;
}
</style>
